package com.express.job;

import com.express.service.TokenService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * token定时任务
 * @author lingzhouf
 */
@Component
public class TokenJob {
  private static Logger logger = LoggerFactory.getLogger(TokenJob.class);

  @Autowired
  TokenService tokenService;
  
//  @Scheduled(cron="0 0 0/24 * * ?")
  @Scheduled(cron="0 0 0 */1 * ?")
  public void clearExpireToken() {
    logger.info("------------执行定时任务：清除无效的token--------------------");
    this.tokenService.clearExpireToken();
    logger.info("------------执行定时任务：清除无效的token(执行完毕)--------------------");
  }
}
